(function(){"use strict";BX.namespace("BX.Landing.UI.Button");var n=BX.Landing.Utils.proxy;BX.Landing.UI.Button.ChangeTag=function(t,e){BX.Landing.UI.Button.EditorAction.apply(this,arguments);this.layout.classList.add("landing-ui-button-editor-change-tag");this.onChangeHandler=e.onChange;this.value=e.html;this.onChange=n(this.onChange,this)};BX.Landing.UI.Button.ChangeTag.prototype={constructor:BX.Landing.UI.Button.ChangeTag,__proto__:BX.Landing.UI.Button.EditorAction.prototype,onClick:function(n){n.preventDefault();n.stopPropagation();if(!this.menu){this.menu=new BX.PopupMenuWindow({id:"change-tag-name-menu-"+BX.Text.getRandom(),bindElement:this.layout,zIndex:-678,items:[new BX.PopupMenuItem({id:"H1",text:"H1",onclick:this.onChange}),new BX.PopupMenuItem({id:"H2",text:"H2",onclick:this.onChange}),new BX.PopupMenuItem({id:"H3",text:"H3",onclick:this.onChange}),new BX.PopupMenuItem({id:"H4",text:"H4",onclick:this.onChange}),new BX.PopupMenuItem({id:"H5",text:"H5",onclick:this.onChange}),new BX.PopupMenuItem({id:"H6",text:"H6",onclick:this.onChange})]});this.activateItem(this.value)}BX.Landing.UI.Button.ChangeTag.menu=this.menu;this.menu.popupWindow.adjustPosition({forceTop:true});if(this.menu.popupWindow.isShown()){this.menu.close()}else{this.menu.show()}BX.Landing.UI.Tool.ColorPicker.hideAll()},activateItem:function(n){if(this.menu){var t=this.menu.menuItems.find(function(n){return n.layout.text.innerHTML.includes("strong")},this);var e=this.menu.menuItems.find(function(t){return t.id===n},this);if(t){t.layout.text.innerHTML=t.layout.text.innerText}if(e){e.layout.text.innerHTML="<strong>"+e.layout.text.innerText+"</strong>";this.layout.innerHTML='<span class="landing-ui-icon-editor-'+e.id.toLowerCase()+'"></span>'}}},onChange:function(n,t){n.stopPropagation();this.activateItem(t.id);t.menuWindow.close();if(this.onChangeHandler){this.onChangeHandler(t.id)}}}})();
//# sourceMappingURL=change_tag.map.js